function request(method, url, callback){
var http = null;
if(window.XMLHttpRequest){
http = new XMLHttpRequest();
}else if(window.ActiveXObject){
http = new ActiveXObject("Microsoft.XMLHTTP");
}
http.open(method, url, true);
http.onreadystatechange = function(){
if(http.readyState == 4){
if(http.status == 200){
callback(http.responseText);
}
}
}
http.send();
}
request("GET", "/api/userinfo", function(html){
console.log(html);
});